C 读写一个字符

#include <stdio.h>
#include <io_utils.h>
#include "errno.h"
#include <string.h>
void ReadFile() {
    FILE *file = fopen("../CMakeLists.txt", "r");
    if (file) {
        int next_char = getc(file);
        while (next_char!=EOF){
            putchar(next_char);
            next_char = getc(file);
        }

        fflush(stdout);
        fclose(file);
    } else {
        PRINT_INT(errno);
        puts(strerror(errno));
        perror("fopen");
    }

//    for (int i = 0; i < 10; ++i) {
//        PRINT_INT(i);
//        puts(strerror(i));
//    }
    fflush(stdout);

}
int main() {
//    while (1){
//        int next_input = getchar();
//        if (next_input == EOF) {
//            break;
//        } else if (next_input == '\n'){
//            continue;
//        }
//        putc(next_input,stdout);
//    }
    ReadFile();

    return 0;
}